package com.example.onion.hxchat.room.entity;

import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.Ignore;
import androidx.room.PrimaryKey;

/**
 * room
 */
@Entity(tableName = "Friend")
public class Friend {
    @PrimaryKey(autoGenerate = true)
    @ColumnInfo(name = "id", typeAffinity = ColumnInfo.INTEGER)
    public int id;

    @ColumnInfo(name = "userName", typeAffinity = ColumnInfo.TEXT)
    public String userName;//好友数据的用户名

    @ColumnInfo(name = "userOwnerName", typeAffinity = ColumnInfo.TEXT)
    public String userOwnerName;//拥有此条好友数据的用户名

    @ColumnInfo(name = "userId", typeAffinity = ColumnInfo.TEXT)
    public String userId;//好友数据的id

    @ColumnInfo(name = "ownerUserId", typeAffinity = ColumnInfo.TEXT)
    public String ownerUserId;//拥有此条好友数据的用户id

    /**
     * Room会使用这个构造器来存储数据，也就是当你从表中得到Student对象时候，Room会使用这个构造器
     */
    public Friend(int id, String userName, String userOwnerName, String userId, String ownerUserId) {
        this.id = id;
        this.userName = userName;
        this.userOwnerName = userOwnerName;
        this.userId = userId;
        this.ownerUserId = ownerUserId;
    }






    /**
     * 由于Room只能识别和使用一个构造器，如果希望定义多个构造器，你可以使用Ignore标签，让Room忽略这个构造器
     * 同样，@Ignore标签还可用于字段，使用@Ignore标签标记过的字段，Room不会持久化该字段的数据
     */
    @Ignore
    public Friend(String userName, String userId, String ownerUserId) {
        this.userName = userName;
        this.userId = userId;
        this.ownerUserId = ownerUserId;
    }
    @Ignore
    public Friend(String userName, String userOwnerName, String userId, String ownerUserId) {
        this.userName = userName;
        this.userOwnerName = userOwnerName;
        this.userId = userId;
        this.ownerUserId = ownerUserId;
    }

    @Ignore
    public Friend(){

    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public void setOwnerUserId(String ownerUserId) {
        this.ownerUserId = ownerUserId;
    }

    public int getId() {
        return id;
    }

    public String getUserName() {
        return userName;
    }

    public String getUserId() {
        return userId;
    }

    public String getOwnerUserId() {
        return ownerUserId;
    }
}